#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include <iostream>
#include <string>

std::string terminal = "/dev/pts/1";

int OpenTerminal() {
  int fd = open(terminal.c_str(), O_WRONLY);
  if (fd < 0) {
    std::cerr << "open terminal error" << std::endl;
    return 1;
  }
  dup2(fd, 2);
  return 0;
}